package com.yksj.healthtalk.ui.server;

import java.util.ArrayList;
import java.util.List;

import org.handmark.pulltorefresh.library.PullToRefreshBase;
import org.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
import org.handmark.pulltorefresh.library.PullToRefreshListView;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;

import com.yksj.healthtalk.adapter.ShopCarAdapter;
import com.yksj.healthtalk.comm.BaseFragmentActivity;
import com.yksj.healthtalk.entity.ShopEntityClassify;
import com.yksj.healthtalk.ui.R;
/**
 * 购物车
 * @author Administrator
 *
 */
public class ServerCenterFreeShopCarActivity extends BaseFragmentActivity implements OnClickListener, OnRefreshListener<ListView> {

	private ListView mListView;
	private PullToRefreshListView mPullToRefreshListView;
	private List<ShopEntityClassify> mListEntitys;
	
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		setContentView(R.layout.server_center_free_shopcar);
		initTitle();
		initView();
		initData();
	}

	private void initData() {
		mListEntitys = new ArrayList<ShopEntityClassify>();
		ShopCarAdapter mshopCaradApter=new ShopCarAdapter(this,mListEntitys);
		mListView.setAdapter(mshopCaradApter);
	}

	private void initView() {
		titleTextV.setText("购物车");
		titleLeftBtn.setOnClickListener(this);
		titleRightBtn2.setVisibility(View.VISIBLE);
		titleRightBtn2.setOnClickListener(this);
		titleRightBtn2.setText("去结算");
		PullToRefreshListView mPullToRefreshListView = (PullToRefreshListView) findViewById(R.id.hall);
		mListView = mPullToRefreshListView.getRefreshableView();
		mPullToRefreshListView.setOnRefreshListener(this);
		mListView.setDivider(getResources().getDrawable(R.drawable.list_divider_bg));
		
		Button shopNum=(Button)findViewById(R.id.setting_bound_mobile);
		Button moneyNum=(Button)findViewById(R.id.setting_bound_emaile);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.title_back:
			onBackPressed();
			break;
		case R.id.title_right2:
			Intent intent=new Intent(this,ServerCenterUserSettleAccountActivity.class);
			startActivity(intent);
			break;
		}
	}
	
	@Override
	public void onRefresh(PullToRefreshBase<ListView> refreshView) {
		mPullToRefreshListView.onRefreshComplete();
	}
}
